import electron =require("electron")


async function start():Promise<void>
{
    await electron.app.whenReady();
    var winstyle: electron.BrowserWindowConstructorOptions ={title:"hello"};
    var url: string = "./win01.js";

    //这个机制保证菜单栏隐藏
    if (winstyle.autoHideMenuBar == undefined)
        winstyle.autoHideMenuBar = true;

        
    //这个机制保证nodejs被打开，这样才能requrie
    if (winstyle.webPreferences == null)
    {
        winstyle.webPreferences = { nodeIntegration: true };
    }
    else
    {

    }
    //打开开发者工具
    winstyle.webPreferences.devTools=true;
    winstyle.webPreferences.nodeIntegration = true;
    winstyle.webPreferences.webSecurity=false;
    winstyle.webPreferences.allowRunningInsecureContent=true;

    var mainWindow = new electron.BrowserWindow(winstyle);
    mainWindow.loadFile("win.html");
    mainWindow.webContents.openDevTools();
}
start();
